<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Edit Products</title>
        <link rel="stylesheet" href="style/table.css" type="text/css">
    </head>
    <body>
        <div id="main_container">
            <jsp:include page="Banner.html" />
            <jsp:include page="menuTab.jsp" />
            <jsp:include page="/AllCategory" />

            <div class="center_content">
                <table summary="Current Products">
                    <caption>Current Products</caption>
                    <thead>
                        <tr>
                            <th scope="col">ID</th>
                            <th scope="col">Name</th>
                            <th scope="col">Price</th>
                            <th scope="col">Category</th>
                            <th scope="col">Amount</th>
                            <th scope="col">Edit</th>
                            <th scope="col">Remove</th>
                        </tr>
                    </thead>
                    <tfoot>
                        <tr>
                            <th scope="row">Total</th>
                            <td colspan="6"><c:out value="${fn:length(allProducts)}" /> Products</td>
                        </tr>
                    </tfoot>
                    <tbody>
                        <c:set var="odd" value="1" />
                        <c:forEach items="${allProducts}" var="product">
                            <c:choose>
                                <c:when test="${odd=='1'}">
                                    <tr class='odd'>
                                        <c:set var="odd" value="0" />
                                    </c:when>
                                    <c:when test="${odd=='0'}">
                                        <tr>
                                        <c:set var="odd" value="1" />
                                    </c:when>
                                </c:choose>
                                <td> <c:out value="${product.productId}" /> </td>
                                <td> <c:out value="${product.productName}" /> </td>
                                <td> <c:out value="${product.price}" /> </td>
                                <td> <c:out value="${product.productCategoryId}" /> </td>
                                <td> <c:out value="${product.amount}" /> </td>
                                <td> <a href="EditProduct?action=get&productID=${product.productId}">Edit</a> </td>
                                <td> <a href="DisplayAllProducts?action=del&ID=${product.productId}">Remove</a> </td>
                            </tr>
                        </c:forEach>
                    </tbody>
                </table>
            </div>
           <jsp:include page="Cart.jsp" />
           <jsp:include page="Footer.html" />
        </div>
                         
    </body>
</html>
